import request from '@/utils/request'
import { getToken } from '@/utils/auth'
export default{
  // 商品列表页-------------------------
  getHealthymallLists(page_num,page_size){
    return request({
      url: `/mall/goods?pageNum=${page_num}&pageSize=${page_size}&sortOrder=SALE_DESC`,
      method: 'GET',
    })
  },
  getHealthymallList(page_num,page_size,searchObj){
    return request({
      url:`/mall/find/goods/${page_num}/${page_size}`,
      method: 'POST',
      data:searchObj,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //商品删除设置
  delmall(goodsId){
    return request({
      method: 'DELETE',
		  url: '/mall?goodsId=' + goodsId,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //商品添加提交submit设置
  admall(list){
    return request({
      method: 'POST',
      url: '/mall',
      data:list
    })
  },
   //商品修改设置
   updatemall(id){
    return request({
        method: 'GET',
        url: '/mall?goodsId=' + id,
    })
  },
    //商品修改提交submit设置
    upsubmitmall(Mall){
      return request({
        method: 'PUT',
        url: '/mall',
        data:Mall
      })
    },
    priceOrsaleNum(page_num,page_size,sort){
      return request({
        url:`/mall/find/sortGoods/${page_num}/${page_size}/${sort}`,
        method:'GET',
        headers: {
                'Authorization':getToken()
              }
      })
    },
    salestatus(goodsId,status){
      return request({
        url:`/mall/update/goodsStatus/${goodsId}/${status}`,
        method:'PUT',
        headers: {
                'Authorization':getToken()
              }
      })
    },
     //批量删除商品
  batchRemoveMall(idList){
    return request({
      url:`/mall/delGoods`,
      method:'DELETE',
      data:idList,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //批量导出商品
  importmall(){
    return request({
      url:'/mall/exportGoodsData',
      method:'GET',
      headers: {
              'Authorization':getToken()
            }
    })
  }
}

